﻿#ifndef _PROPTIP_H_
#define _PROPTIP_H_
#include "ui/CocosGUI.h"
#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
#include "Prop.h"
#include <vector>
//class Prop;
class PropTip : public cocos2d::ui::Widget {
public:
	PropTip(PropType type);
	static PropTip* create(PropType type);
	bool init();
	void initCSBFile();
	void initSpriteFrameCache();
	void loadingUpdate(float dt);
	cocos2d::Size getPropTipSize() const {
		return propTipsize;
	}
	PropType getPropType()const {
		return type;
	}
	void reset();
public:
	//function<返回值类型(形参表)> 变量名
	typedef std::function<void(bool)> ccPropTipBeganCallback;
	typedef std::function<void(bool)> ccPropTipEndedCallback;

	ccPropTipBeganCallback onPropTipBegan;//指向当冷却开始时要调用的函数
	ccPropTipEndedCallback onPropTipEnded;//指向当冷却结束时要调用的函数
private:
	PropType type;
	int loadingCount;
	cocos2d::Size size;
	cocos2d::Size propTipsize;
	cocos2d::Node* root;
	cocos2d::Sprite* prop_tip;
	std::vector<cocos2d::ui::LoadingBar*> loadingVec;
	cocos2d::SpriteFrameCache* gameSpriteCache;
};
#endif // !_PROPTIP_H_



